﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace NDBGen.Tests
{
    public class DataInputBuilder
    {
        public static DataInputContainer With(String group, params String[] scripts)
        {
            return new DataInputContainer().With(group, scripts);
        }

        public class DataInputContainer
        {
            public DataInputContainer()
            {
                this.Builder = new Dictionary<String, List<String>>();
            }

            private Dictionary<String, List<String>> Builder { get; set; }


            public DataInputContainer With(String group, params String[] scripts)
            {
                if (this.Builder.ContainsKey(group)) this.Builder[group].AddRange(scripts);
                else this.Builder.Add(group, new List<String>(scripts));

                return this;
            }

            public Dictionary<String, String[]> ToDictionary()
            {
                return this.Builder.ToDictionary(e => e.Key, e => e.Value.ToArray());
            }
        }
    }
}